<?php
    $dp = new jDatePicker();
    $dp->__dateFormat = "yy-mm-dd";
    echo "<scr"."ipt type=\"text/javascript\">";
    $dp->generateDP("tanggal_lahir");
    $dp->generateDP("tanggal_masuk");
    echo "</scr"."ipt>";
    $dp->init();
    ?>
    
    <?php
    ?>
    <h3 class="title-popup">Form <?php echo ($kode==""?"Tambah":"Ubah"); ?> Data Karyawan</h3>

    <form action="" method="post" onsubmit="return save()" enctype="multipart/form-data">
<?php
    if($msg!="") {
?>
    <div class="BoxMessage Warning">Proses Gagal, <br /><?php echo $msg;?></div>
<?php
    }

?>

    <fieldset class="fldInput">

    <dl>
    <dt class="mandatory">Divisi </dt>
    <dd>
        <input class="read-only" type="text" name="divisi_karyawan" id="divisi_karyawan" value="<?php echo $divisi_karyawan;?>" maxlength="40" size="50" readonly="readonly" />
        <input type="hidden" name="id_divisi_karyawan" id="id_divisi_karyawan" value="<?php echo $id_divisi_karyawan;?>"   />
        <?php echo $gbdivisi; 
        ////echo Greybox::createLink(base_url()."index.php/popup/divisi_karyawan", "<span>Cari</span>", "Cari Divisi", "find", "", 750, 450)?>

    </dd>
    
    <dt class="mandatory">NIK</dt>
    <dd><input type="text" name="nik" id="nik" value="<?php echo $nik;?>" maxlength="40" size="30" /></dd>

    <dt class="mandatory">Nama Lengkap</dt>
    <dd><input type="text" name="nama" id="nama" value="<?php echo $nama;?>" maxlength="200" size="50"  /></dd>

    <dt>Nama Panggilan</dt>
    <dd><input type="text" name="nama_panggilan" id="nama_panggilan" value="<?php echo $nama_panggilan;?>" maxlength="100" size="45"  /></dd>
    
    <dt class="mandatory">Tempat Lahir</dt>
    <dd><input type="text" name="tempat_lahir" id="tempat_lahir" value="<?php echo $tempat_lahir;?>" maxlength="100" size="35"  /></dd>

    <dt class="mandatory">Tanggal Lahir</dt>
    <dd><input class="read-only" type="text" name="tanggal_lahir" id="tanggal_lahir" value="<?php echo $tanggal_lahir;?>" maxlength="10" size="10" readonly="readonly"  /></dd>
    
    <dt>Alamat</dt>
    <dd><textarea name="alamat" id="alamat" rows="3" cols="40" ><?php echo $alamat;?></textarea></dd>

    <dt>Kota</dt>
    <dd><input type="text" name="kota" id="kota" value="<?php echo $kota;?>" maxlength="100" size="35"  /></dd>

    <dt>Propinsi</dt>
    <dd><input type="text" name="propinsi" id="propinsi" value="<?php echo $propinsi;?>" maxlength="100" size="35"  /></dd>

    <dt>Agama</dt>
    <dd><?php echo Generic::createComboArray2("agama", array("ISLAM"=>"Islam", "KRISTEN"=>"Kristen", "KATOLIK"=>"Katolik", "HINDU"=>"Hindu", "BUDHA"=>"Budha"), $agama); ?></dd>

    <dt>Kewarganegaraan</dt>
    <dd><input type="text" name="warga_negara" id="warga_negara" value="<?php echo $warga_negara;?>" maxlength="40" size="35"  /></dd>

    <dt >Status Kawin</dt>
    <dd><?php echo Generic::createComboArray2("status_marital", array("KAWIN"=>"Kawin", "TIDAK KAWIN"=>"Tidak Kawin"), $status_marital); ?></dd>

    <dt>No. Telp</dt>
    <dd><input type="text" name="no_telepon" id="no_telepon" value="<?php echo $no_telepon;?>" maxlength="40" size="35"  /></dd>

    <dt class="mandatory">No. HP</dt>
    <dd><input type="text" name="no_hp" id="no_hp" value="<?php echo $no_hp;?>" maxlength="40" size="35"  /></dd>

    <dt class="mandatory">Email</dt>
    <dd><input type="text" name="email" id="email" value="<?php echo $email;?>" maxlength="200" size="35"  /></dd>

    <dt class="mandatory">Tanggal Masuk</dt>
    <dd><input class="read-only" type="text" name="tanggal_masuk" id="tanggal_masuk" value="<?php echo $tanggal_masuk;?>" maxlength="10" size="10" readonly="readonly"  /></dd>

    
    <dt>&nbsp;</dt>
    <dd>
        <ul id="note">
            <li>Field dengan remark harus diisi.</li>
            <li>Gunakan tombol Cari untuk field dengan property read-only.</li>
        </ul>
    </dd>
    </dl>
    </fieldset>
    <div id="box-control-save">
    <input type="hidden" name="vSave" id="vSave" value="1" />
    <input type="hidden" name="kode" id="kode" value="<?php echo $kode?>" />
    <input type="hidden" name="vMode" value="<?php echo ($kode==""?"add":"edit"); ?>" />
    <input type="submit" class="CommandButton" name="btnSimpan" value="Save"/>&nbsp;
    <input type="button" class="CommandButton" value="Cancel" onclick="javascript:closeGB_();"/>
    </div>
    </form>
<script type="text/javascript">
/*window.parent.parent.GB_hide();window.parent.parent.location.reload()*/
    function closeGB_ (){
            <?php echo CloseGB(true);?>
    }

    function save() {
            var nik = document.getElementById("nik");
            var nama = document.getElementById("nama");
            var tempat_lahir = document.getElementById("tempat_lahir");
            var tanggal_lahir = document.getElementById("tanggal_lahir");
            var no_hp = document.getElementById("no_hp");
            var email = document.getElementById("email");
            var tanggal_masuk = document.getElementById("tanggal_masuk");

            return true;
    }

    function trimValue(str){
            var out = "";
            out = str.replace(/^\s+|\s+$/g,"");
            return out;
    }

    function _obj_fSendValue(kode, nama, elmKode, elmNama) {
            var elmk = document.getElementById("" + elmKode + "");
            var elmn = document.getElementById("" + elmNama + "");
            try {
                    elmk.value = kode;
                    elmn.value = nama;
            }
            catch(e) {
                    alert(e.message);
            }
    }



</script>
